//
//  myResumeCellEduRowsView.swift
//  DingDongZP
//
//  Created by 三秒文化 on 16/4/9.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

import UIKit

class myResumeCellEduRowsView: UIView {
    
    var eduOrga:UILabel?
    var eduOrgaTime:UILabel?
    var eduSpecial:UILabel?
    
    var dotView:UIImageView?
    var divideLine:UIView?
    
    var model:myResumeCellEduExperModel_edu? {
        didSet{
            
            updateFrame()
        }
    }
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setDefaultContent()
        setupFrame()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func updateFrame() {
        
        eduOrga?.text = model?.institutename
        eduOrgaTime?.text = "\((model?.startdate)! as String) - \((model?.enddate)! as String)"
        eduSpecial?.text = "\(model!.majortitle) | \(model!.edu)"
    }
    
    func setDefaultContent() {
        
        eduOrga = UILabel.setDetailsLab("XXXX学校", fontSize: 15, titleColor: LDFontColor.Green,Alignment: nil)
        eduOrgaTime = UILabel.setDetailsLab("2011 - 2011", fontSize: 12, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Right)
        eduSpecial = UILabel.setDetailsLab("专业名称 | 学位", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: nil)
        
        dotView = UIImageView(image: UIImage(named: "green_dot"))
        divideLine = UIView()
        divideLine?.backgroundColor = LDLineColorLightGray
        
        addSubview(eduOrga!)
        addSubview(eduOrgaTime!)
        addSubview(eduSpecial!)
        
        addSubview(dotView!)
        addSubview(divideLine!)
    }
    
    func setupFrame() {
        
        dotView?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(0)//.offset(LDMargin_V*3)
            make.left.equalTo(0)
            make.size.equalTo(CGSizeMake(10, 10))
        })
        
        divideLine?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(dotView!.snp_bottom)
            make.centerX.equalTo(dotView!)
            make.bottom.equalTo(0)
            make.width.equalTo(0.5)
        })
        
        
        eduOrga?.snp_makeConstraints(closure: { (make) in
            
            make.left.equalTo(dotView!.snp_right).offset(LDMargin_V*2)
            //            make.top.equalTo(0)
            make.centerY.equalTo(dotView!)
            make.size.equalTo(CGSizeMake(180, 18))
        })
        
        eduOrgaTime?.snp_makeConstraints(closure: { (make) in
            
            make.top.right.equalTo(0)
            make.size.equalTo(CGSizeMake(120, 15))
        })
        
        eduSpecial?.snp_makeConstraints(closure: { (make) in
            
            make.left.equalTo(eduOrga!)
            make.right.equalTo(0)
            make.top.equalTo((eduOrga?.snp_bottom)!).offset(LDMargin_V)
            make.height.equalTo(15)
        })
    }
    
}


////
////  myResumeCellEduRowsView.swift
////  DingDongZP
////
////  Created by 三秒文化 on 16/4/9.
////  Copyright © 2016年 iyhjiang.com. All rights reserved.
////
//
//import UIKit
//
//class myResumeCellEduRowsView: UIView {
//    
//    var eduOrga:UILabel?
//    var eduOrgaTime:UILabel?
//    var eduSpecial:UILabel?
//    
//    var dotView:UIImageView?
//    var divideLine:UIView?
//    
//    var model:myResumeCellEduExperModel_edu? {
//        didSet{
//            
//            updateFrame()
//        }
//    }
//    
//    
//    
//    override init(frame: CGRect) {
//        super.init(frame: frame)
//        setDefaultContent()
//        setupFrame()
//    }
//    required init?(coder aDecoder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }
//    
//    func updateFrame() {
//        
//        eduOrga?.text = model?.institutename
//        eduOrgaTime?.text = "\((model?.startdate)! as String) - \((model?.enddate)! as String)"
//        eduSpecial?.text = "\(model!.majortitle) | \(model!.edu)"
//    }
//    
//    func setDefaultContent() {
//        
//        eduOrga = UILabel.setDetailsLab("XXXX学校", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: nil)
//        eduOrgaTime = UILabel.setDetailsLab("2011 - 2011", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: .Left)
//        eduSpecial = UILabel.setDetailsLab("专业名称 | 学位", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: nil)
//        
//        dotView = UIImageView(image: UIImage(named: "green_dot"))
//        divideLine = UIView()
//        divideLine?.backgroundColor = LDLineColorLightGray
//        
//        addSubview(eduOrga!)
//        addSubview(eduOrgaTime!)
//        addSubview(eduSpecial!)
//        
//        addSubview(dotView!)
//        addSubview(divideLine!)
//    }
//    
//    func setupFrame() {
//        
//        dotView?.snp_makeConstraints(closure: { (make) in
//            
//            make.top.equalTo(0)//.offset(LDMargin_V*3)
//            make.left.equalTo(0)
//            make.size.equalTo(CGSizeMake(10, 10))
//        })
//        
//        divideLine?.snp_makeConstraints(closure: { (make) in
//            
//            make.top.equalTo(dotView!.snp_bottom)
//            make.centerX.equalTo(dotView!)
//            make.bottom.equalTo(0)
//            make.width.equalTo(0.5)
//        })
//        
//        eduOrgaTime?.snp_makeConstraints(closure: { (make) in
//            
//            make.left.equalTo(dotView!.snp_right).offset(LDMargin_V*2)
//            make.right.equalTo(-LDMargin_V)
//            make.centerY.equalTo(dotView!)
//            make.height.equalTo(25)
//            
//        })
//        
//        eduOrga?.snp_makeConstraints(closure: { (make) in
//            
//            make.top.equalTo(eduOrgaTime!.snp_bottom).offset(LDMargin_V)
//            make.left.height.right.equalTo(eduOrgaTime!)
//            
//        })
//        
////        eduOrgaTime?.snp_makeConstraints(closure: { (make) in
////            
////            make.top.right.equalTo(0)
////            make.size.equalTo(CGSizeMake(120, 15))
////        })
//        
//        eduSpecial?.snp_makeConstraints(closure: { (make) in
//            
//            make.top.equalTo(eduOrga!.snp_bottom).offset(LDMargin_V)
//            make.left.height.right.equalTo(eduOrgaTime!)
//        })
//    }
//    
//}

class LDMyResumeCellEduRowsView: UIView {
    
    var eduOrga:UILabel?
    var eduOrgaTime:UILabel?
    var eduSpecial:UILabel?
    
    var dotView:UIImageView?
    var divideLine:UIView?
    
    var model:myResumeCellEduExperModel_edu? {
        didSet{
            
            updateFrame()
        }
    }
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setDefaultContent()
        setupFrame()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func updateFrame() {
        
        eduOrga?.text = model?.institutename
        eduOrgaTime?.text = "\((model?.startdate)! as String) - \((model?.enddate)! as String)"
        eduSpecial?.text = "\(model!.majortitle) | \(model!.edu)"
    }
    
    func setDefaultContent() {
        
        eduOrga = UILabel.setDetailsLab("XXXX学校", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: nil)
        eduOrgaTime = UILabel.setDetailsLab("2011 - 2011", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: .Left)
        eduSpecial = UILabel.setDetailsLab("专业名称 | 学位", fontSize: 14, titleColor: LDFontColor.DeepGray,Alignment: nil)
        
        dotView = UIImageView(image: UIImage(named: "green_dot"))
        divideLine = UIView()
        divideLine?.backgroundColor = LDLineColorLightGray
        
        addSubview(eduOrga!)
        addSubview(eduOrgaTime!)
        addSubview(eduSpecial!)
        
        addSubview(dotView!)
        addSubview(divideLine!)
    }
    
    func setupFrame() {
        
        dotView?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(0)//.offset(LDMargin_V*3)
            make.left.equalTo(0)
            make.size.equalTo(CGSizeMake(10, 10))
        })
        
        divideLine?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(dotView!.snp_bottom)
            make.centerX.equalTo(dotView!)
            make.bottom.equalTo(0)
            make.width.equalTo(0.5)
        })
        
        eduOrgaTime?.snp_makeConstraints(closure: { (make) in
            
            make.left.equalTo(dotView!.snp_right).offset(LDMargin_V*2)
            make.right.equalTo(-LDMargin_V)
            make.centerY.equalTo(dotView!)
            make.height.equalTo(25)
            
        })
        
        eduOrga?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(eduOrgaTime!.snp_bottom).offset(LDMargin_V)
            make.left.height.right.equalTo(eduOrgaTime!)
            
        })
        
        //        eduOrgaTime?.snp_makeConstraints(closure: { (make) in
        //
        //            make.top.right.equalTo(0)
        //            make.size.equalTo(CGSizeMake(120, 15))
        //        })
        
        eduSpecial?.snp_makeConstraints(closure: { (make) in
            
            make.top.equalTo(eduOrga!.snp_bottom).offset(LDMargin_V)
            make.left.height.right.equalTo(eduOrgaTime!)
        })
    }
    
}
